﻿using System.Web.UI;
using Nexia.FluentHtmlElements.Elements;

namespace Nexia.FluentHtmlElements
{
	public static class FluentHtmlControlExtensions
	{
		private static readonly TagFactory Tags;

		static FluentHtmlControlExtensions()
		{
			Tags = new TagFactory();
		}

		public static Div Div(this Control parentControl)
		{
			return Tags.Div();
		}

		/// <summary>
		/// Create a hyperlink tag
		/// </summary>
		/// <param name="parentControl">The control being extended</param>
		/// <returns></returns>
		public static HyperLink HyperLink(this Control parentControl)
		{
			return Tags.A();
		}

		/// <summary>
		/// Create a span tag
		/// </summary>
		/// <param name="parentControl">The control being extended</param>
		/// <returns></returns>
		public static Span Span(this Control parentControl)
		{
			return Tags.Span();
		}

		/// <summary>
		/// Create a image tag
		/// </summary>
		/// <param name="parentControl">The control being extended</param>
		/// <returns></returns>
		public static Image Img(this Control parentControl)
		{
			return Tags.Img();
		}

		#region Lists

		/// <summary>
		/// Create a ol tag
		/// </summary>
		/// <param name="parentControl">The control being extended</param>
		/// <returns></returns>
		public static OrderedList Ol(this Control parentControl)
		{
			return Tags.Ol();
		}

		/// <summary>
		/// Create a ul tag
		/// </summary>
		/// <param name="parentControl">The control being extended</param>
		/// <returns></returns>
		public static UnorderedList Ul(this Control parentControl)
		{
			return Tags.Ul();
		}

		/// <summary>
		/// Create a li tag
		/// </summary>
		/// <param name="parentControl">The control being extended</param>
		/// <returns></returns>
		public static ListItem Li(this Control parentControl)
		{
			return Tags.Li();
		}

		#endregion Lists
	}
}
